/*
 * mainserver.h
 *
 *  Created on: 2011-8-7
 *      Author: minorityee1984@gmail.com
 *     Purpose: 服务器主线程
 *        Note:
 */

#ifndef MAINSERVER_H_
#define MAINSERVER_H_

#include "common/type_def.h"
#include "global.h"
#include "iothread.h"
#include "loki/Singleton.h"

#define DEFAULT_MAINSERVER_LOG		"./log/agentserver"

class CMainServer
{
public:
	enum
	{
		enmCommand_Nop = 0,
		enmCommand_Reload,
		enmCommand_Term,
	};
public:
	CMainServer();
	~CMainServer();
public:
	int32_t Initialize();
	int32_t Uninitialize();
	int32_t Reload();
	void Terminate();

	void Run();

private:
	AgentServerLogThread m_logThread;
	CIOThread			 m_IOThread;

	RadarDataQueueType	 &m_radarDataQueue;
	ClientDataQueueType  &m_clientDataQueue;
	int32_t 			m_command;
};

typedef Loki::SingletonHolder<CMainServer> MainServer;
#define CREATE_MAINSERVER_INSTANCE MainServer::Instance
#define GET_MAINSERVER_INSTANCE MainServer::Instance

#endif /* MAINSERVER_H_ */
